<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This tests that inserting a newline at the beginning of quoted content doesn't add an extra quoted line.
// The test has passed if there are no empty lines (quoted or unquoted) in the root editable div.

selection_test(
    `<div contenteditable="true">
       <blockquote type="cite"><div>|quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'InsertNewLineInQuotedContent',
    `<div contenteditable="true">
       |<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'Step 1');

selection_test(
    `<div contenteditable="true">
       |<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'InsertText unquoted',
    `<div contenteditable="true">
       unquoted|<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'Step 2');

selection_test(
    `<div contenteditable="true">
       unquoted<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div><div><blockquote type="cite"><div>|quote level two</div></blockquote></div></blockquote>
    </div>`,
    'InsertNewlineInQuotedContent',
    `<div contenteditable="true">
       unquoted<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div></blockquote>|<br><blockquote type="cite"><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'Step 3');

selection_test(
    `<div contenteditable="true">
       unquoted<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div></blockquote>|<br><blockquote type="cite"><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'InsertText unquoted',
    `<div contenteditable="true">
       unquoted<br><blockquote type="cite"><div>quote level one</div></blockquote>
       <blockquote type="cite"><div>quote level one</div></blockquote>unquoted|<br><blockquote type="cite"><div><blockquote type="cite"><div>quote level two</div></blockquote></div></blockquote>
    </div>`,
    'Step 4');
</script>
